package com.specter.test.utils;

import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;

import org.junit.jupiter.api.Test;

public class Bean {

    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Test
    public  void test() {
        try {
            Bean b = new Bean();
            b.setId("hello world!");

            Method m = new PropertyDescriptor("id", Bean.class).getReadMethod();
            String id = (String) m.invoke(b);

            System.out.println(id);
        } catch (Exception e) {
            System.out.println("error!");
        }

    }
}